<!DOCTYPE htm PUBLIC "-//W3C//DTD Xhtm 1.0 Transitional//EN" "DTD/xhtm1-transitional.dtd">
<htm xmlns="http://www.w3.org/1999/xhtm" xml:lang="de" lang="de">
<head>
 <meta http-equiv="content-type" content="text/htm; charset=iso-8859-1" />
 <meta http-equiv="content-style-type" content="text/css" />
 <meta name="author" content="Arlsair" />
 <meta name="date" content="2004-01-22" />
 <title>MPEG2Dec</title>
 <link rel="stylesheet" type="text/css" href="../../style.css" />
</head><body>
<h1>MPEG2Dec</h1>

<h2>&Uuml;bersicht</h2>
<b>Autor:</b> Dividee und andere<br />
<b>Version:</b> 1.10<br />
<b>Download:</b> <a href="http://www.avisynth.org/warpenterprises/" target="_blank">http://www.avisynth.org/warpenterprises/</a> / <a href="http://users.win.be/dividee/avisynth.html" target="_blank">Quellcode</a><br />
<b>Kategorie:</b> MPEG Dekoder<br />
<b>Anforderungen:</b> keine<br />
<hr>
<h2>Description</h2>
This filter is able to output in the RGB and YUY2 colorformats.<br>
It is a MPEG-2 decoder and it is able to decode any MPEG-2 streams readable by
dvd2avi 1.76
<h2>Filters</h2>
<p>A list of all filters included in this special mpeg2dec.dll:</p>
<h3>TemporalSmoother</h3>
<p><tt>TemporalSmoother(</tt><i>clip</i>[<tt>,</tt><i>strength</i>[<tt>,</tt><i>radius</i>]]<tt>)</tt>
<p>This is a port of the <tt>TemporalSmoother</tt> filter from <a href="http://www.virtualdub.org/index" target="_parent">VirtualDub</a>.
It works in RGB32 &amp; YUY2 pixel formats.<br>
From VirtualDub help file:
<blockquote>
  This filter is an adaptive noise reducer, working along the time axis; it is
  most effective when the image is not moving much. Increase the filter strength
  to increase noise reduction, and decrease it to reduce speckling and ghosting
  artifacts. It is recommended that you combine this filter with a spatial
  (area-based) noise reducer for greatest effect.
</blockquote>
All frames no more than <i>radius</i> away are examined. Minimum <i>radius</i>
is 1, maximum is 7. Larger values are of course slower. Default is 3, which is
the value used in VirtualDub. The default value for <i>strength</i> is 2.
<p>Note that unlike its VirtualDub counterpart, this filter has no lag. It
ensures that the frames needed for its work are in its buffer. Therefore, random
access in the clip is slow, especially with a large <i>radius</i>.
<p>Example:
<pre># The filter effects in RGB and YUV are not 100% equivalent, especially with a high strength.
# Let's visualize the difference

cYUY2 = ConvertToRGB(TemporalSmoother(ConvertToYUY2,10))
cRGB = TemporalSmoother(10)
Subtract(cYUY2, cRGB)
</pre>
<h3>SelectRangeEvery</h3>
<p><tt>SelectRangeEvery(</tt><i>clip</i><tt>,</tt><i>every</i><tt>,</tt><i>length</i>[<tt>,</tt><i>offset</i>]<tt>)</tt>
<p>Select <i>length</i> frames every <i>every</i> frames, starting after <i>offset</i>.
<p><tt>SelectRangeEvery(</tt><i>every</i><tt>,</tt><i>length</i><tt>,</tt><i>offset</i><tt>)</tt>
is the same as <tt>SelectRangeEvery(Trim(</tt><i>offset</i><tt>,0),</tt><i>every</i><tt>,</tt><i>length</i><tt>)</tt>
<p>&nbsp;
<h3>BlendFields</h3>
<p><tt>BlendFields(</tt><i>clip</i><tt>)</tt>
<p>Deinterlace a clip by blending the fields together. This is the blend mode of
the internal vdub deinterlace filter ported to avisynth. It works in RGB and YUV
modes. If avisynth reports a field-based clip, <tt>Weave</tt> is performed, so
the output is always frame-based. If avisynth guessed wrong, use <tt>AssumeFrameBased</tt>
beforehand.
<p>&nbsp;
<h3>MotionMask</h3>
<p><tt>MotionMask(</tt><i>clip</i><tt>,</tt><i>mode</i><tt>,</tt><i>treshold</i>[<tt>,</tt><i>denoise</i>[<tt>,</tt><i>fast</i>]]<tt>)</tt></p>
<p>Creates a two color clip that identifies moving parts of the images. The
algorithm comes from <a href="http://sauron.mordor.net/dgraft/" target="_parent">Donald
Graft</a>' Smart Deinterlacer filter for VirtualDub, version 2.5. <i>mode</i> is
an integer that can take 3 values: 1 for frame-only differencing, 2 for
field-only differencing and 3 for frame-and-field differencing. <i>treshold</i>
(integer) is the sensivity of the filter. A lower <i>treshold</i> makes it more
sensitive to motion and, as a side-effect, to noise. <i>denoise</i> (boolean,
default=true) activates additional filtering to reduce false motion detection
due to noise and allows you to use lower tresholds. <i>fast</i> (boolean,
default=false) makes the filter runs faster by working two pixels at a time but
is less precise.</p>
<p>For a more thorough explanation of the parameters, please read the help file
included with the <a href="http://sauron.mordor.net/dgraft/smart.html" target="_parent">Smart
Deinterlacer for VirtualDub</a>.</p>
<p>Currently <tt>MotionMask</tt> only handles YUY2 data. Also note that the
color mode of the VirtualDub filter is not supported (yet).</p>
<h2>MaskedDeinterlace</h2>
<p><tt>MaskedDeinterlace(</tt><i>clip</i><tt>,</tt><i>mask</i>[<tt>,</tt><i>blend</i>]<tt>)</tt></p>
<p><tt>MaskedDeinterlace</tt> is designed to work together with <tt>MotionMask</tt>.
It selectively deinterlace the <i>clip</i> based on the <i>mask</i> values. <i>mask</i>
is a clip returned by <i>MotionMask</i>. <i>blend</i> (boolean, default=false)
indicates whether deinterlacing is performed by discarding half of the lines
(one field) and interpolating them (when <i>blend</i> is false), or by blending
together adjacent lines (when <i>blend</i> is true).</p>
<p><i>mask</i> and <i>clip</i> should have the same width, height and pixel
format</p>
<h3>SmartDeinterlace</h3>
<p><tt>SmartDeinterlace(</tt><i>clip</i><tt>,</tt><i>mode</i><tt>,</tt><i>treshold</i>[<tt>,</tt><i>denoise</i>[<tt>,</tt><i>blend</i>[<tt>,</tt><i>fast</i>]]]<tt>)</tt></p>
<p>This is just a shortcut for:</p>
<p><tt>MaskedDeinterlace(</tt><i>clip</i><tt>,MotionMask(</tt><i>clip</i><tt>,</tt><i>mode</i><tt>,</tt><i>treshold</i><tt>,</tt><i>denoise</i><tt>,</tt><i>fast</i><tt>),</tt><i>blend</i><tt>)</tt></p>
<p>It shows that these filters are really only a port of Donald Graft' Smart
Deinterlacer.</p>
<h3>MaskedMix</h3>
<p><tt>MaskedMix(</tt><i>clip1</i><tt>,</tt><i>clip2</i><tt>,</tt><i>mask</i><tt>)</tt></p>
<p>Returns a clip where each pixel is selected either from <i>clip1</i> or <i>clip2</i>
based on the <i>mask</i> value for the pixel. The three clips should have the
same width, height and pixel format. It allows you to use other deinterlacing
methods than the two provided with <tt>MaskedDeinterlace</tt>.</p>
<p>As an example, the following script can be used to reproduce the &quot;Show
motion areas only&quot; option of Smart Deinterlacer for VirtualDub:</p>
<pre>mask=MotionMask(3,10,true)
deint=BlendFields
tmp=Blackness.Levels(0,1,255,127,127)
MaskedMix(tmp,deint,mask)
</pre>
</body>
</html>